﻿#ifndef PST_FORMULAEDITORDIALOG_H
#define PST_FORMULAEDITORDIALOG_H

#include <QWidget.h>
#include <QModelIndexList>
#include <QPair>
#include <QList>
#include "BaseWidget/IdaDialogFrame.h"

QT_BEGIN_NAMESPACE
namespace Ui
{
    class FormulaEditorDialog;
};
class QComboBox;
class QLineEdit;
QT_END_NAMESPACE

namespace pst
{
    class Curve2DKeySelcetBar;

    class FormulaEditorDialog : public IdaDialogFrame
    {
        Q_OBJECT

    public:
        FormulaEditorDialog(QWidget* parent = nullptr);
        ~FormulaEditorDialog();

        void updateUI();
        void setCurveList(QStringList curveList);
        QString getFormulaContent();
        void setFormulaContent(const QString& formulaContent);

    public slots:
        void reject() override;
        void accept() override;

        void on_comboBox_SelectionCurve_currentIndexChanged(int index);
        void on_comboBox_CallingFormula_currentIndexChanged(const QString& content);
        void on_comboBox_CallConstant_currentIndexChanged(const QString& content);

    signals:
        void signal_calculationCheck(const QString& formulaContent, bool& isSuccess);

    private:
        Ui::FormulaEditorDialog* m_ui;
        QString m_formulaContent;
        int m_curveIndex;
        QString m_currentFormula;
        QString m_currentConstant;
        QStringList m_curveList;
    };
} // namespace pst

#endif
